<template>
  <div>
    <card
      title="基本信息"
      :headstyle="cardstyle"
      :class="initAnchorInfo"
      shadow="nerver"
    >
      <el-row :gutter="12">
        <el-col :span="6">船名/航次：<span class="value">{{ infoform.SHIPNAME }}/{{ infoform.VOYAGE }}</span></el-col>
        <el-col :span="6">内外贸：<span class="value">{{ infoform.TRADETYPENAME }}</span></el-col>
        <el-col :span="6">起运港：<span class="value">{{ infoform.PORTNAME }}</span></el-col>
        <el-col :span="6">流向：<span class="value">{{ infoform.DIRECTCODE }}</span></el-col>
      </el-row>
      <PublicTable
        ref="table1"
        :loading="false"
        :table-data="info"
        :columns="columns"
        :options="options"
      />
    </card>
  </div>
</template>

<script>

const columns = [
  {
    label: "靠泊泊位",
    prop: "ORGBERTH",
    minwidth: "60",
  },
  {
    label: "靠泊时间",
    prop: "BERTHTIME",
    minwidth: "140",
  },
  {
    label: "开工时间",
    prop: "STARTTIME",
    minwidth: "140",
  },
  {
    label: "完工时间",
    prop: "ENDTIME",
    minwidth: "140",
  },
  {
    label: "离泊时间",
    prop: "LEAVETIME",
    minwidth: "140",
  },
  {
    label: "停泊时长h",
    prop: "TBSC",
    minwidth: "60",
  },
  {
    label: "作业时长h",
    prop: "ZYSC",
    minwidth: "60",
  },
  {
    label: "卸船效率",
    prop: "XCXL",
    minwidth: "60",
  },
  {
    label: "配载吨",
    prop: "SJZZD",
    minwidth: "70",
  },
  {
    label: "货名",
    prop: "CARGONAME",
    minwidth: "110",
  },
  {
    label: "盈亏吨",
    prop: "EARNINGTONS",
    minwidth: "110",
  },
  {
    label: "盈亏率",
    prop: "YKDL",
    minwidth: "110",
  },
];
export default {
  name: "Info",
  props: {
    initAnchorInfo: {
      type: String,
      default: "xxxxxxxx",
    },
    cardstyle: {
      type: Object,
      default() {
        return {}
      },
    },
    shipseq: {
      type: String,
      default() {
        return ""
      },
    },
  },
  data() {
    return {
      info: [],
      columns,
      options: {},
    }
  },
  computed: {
    infoform() {
      return this.info[0] || {}
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.queryinfo()
    },
    // 查询船舶基本信息
    queryinfo() {
      this.$api.summary.get_shipinfodm({ shipseq: this.shipseq }).then((val) => {
        this.info = val
      })
    },
  }
}
</script>

<style lang="scss" scoped>

</style>
